<?php
require_once '../funciones/funciones.php';
$temaId = $_GET["temaId"];
$partId = $_SESSION["partId"];
$con = new MySQL;
$sql = "select * from temas where `temaId` = '$temaId'";
$result = $con->consulta($sql);
$tema = $con->unaFila($result);
$sql = "select * from evaluacionesypruebas eval
    inner join subtemas subt on subt.subtemaId = eval.subtemaId
    where eval.`partId` = '$partId' and  eval.`evalTipo` = 'E' and subt.temaId = '{$tema["temaId"]}' order by eval.evalFec desc ";
$evaluaciones = $con->consulta($sql);
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <?php require_once '../includes/head.html'; ?>
        <title></title>
        <script type="text/javascript">
            $(document).ready(function(){
<?php require_once '../includes/jsEnReady.php'; ?>
    }); // fin $(document).ready(function(){
    function fnConsulta(){
        window.location = "conSugerencias.php?pop=bazinga&temaId=<?php echo $tema["temaId"]; ?>";
    }
        </script>
        <style type="text/css">
            table{
                -moz-border-radius:7px;
                -webkit-border-radius:7px;
                border-radius:7px;
                -moz-box-shadow:0px 0px 6px #000000;
                -webkit-box-shadow:0px 0px 6px #000000;
                box-shadow:0px 0px 6px #000000;
                opacity:0.99;
                -ms-filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=99);
                margin: auto auto;
                padding: 1px 2px;
                border-right-width: 11px;
                /*                border-collapse: separate;*/
                /*                border-spacing:10px;*/
                font-size: 18px;
            }
            table tbody tr:nth-child(2n+1){
                background-color: #E0E9F2;
                /*                border-collapse: collapse;
                                border-color: 1px #C8DDF4;*/
            }

            table th{
                border-bottom: 1px black inset;
            }
            table tbody td{
                padding: 1px 2px;
            }
            .td1{
                text-align: center;
            }
            .notas{
                text-align: center;
                font-weight: bolder;
            }
            .notasMal {
                color: red;
            }
            .notasBien{
                color: #6AC942;
            }
        </style>
    </head>
    <body>
        <div class="ui-accordion-header ui-state-default ui-corner-all titulo" id="divPruebaTapion">TEMA: <?php echo $tema["temaNombre"]; ?></div>
        <?php require_once '../includes/body.php'; ?>
        <div style="float: right">
            <input type="button" value="Consultar Sugerencias del Tema" onclick="fnConsulta();" />
        </div>
        <div class="pregunta">
            <p>A continuación encontraras todos los resultados obtenidos en las evaluaciones que has presentado.</p>
        </div>
        <div>
            <table>
                <thead>
                <th>FECHA</th>
                <th>NOTA</th>
                </thead>
                <tbody>
                    <?php
                    if ($con->numeroFilas($evaluaciones) == 0) {
                        echo "<td colspan='2'>No has presentado evaluaciones</td>";
                    } else {
                        while ($evalua = $con->unaFila($evaluaciones)) {
                            echo "<tr>";
                            echo "<td>" . $evalua["evalFec"] . "</td>";
                            $nota = $evalua["evalCalificacion"];
                            $class = ($nota < 3.5) ? "notasMal" : "notasBien";
                            echo "<td class='notas $class'>$nota</td>";
                            echo "</tr>";
                        }
                    }
                    ?>
                </tbody>
            </table>
        </div>
    </body>
</html>
